Skip to content

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Aug 31, 2025

Delete redundant caches for EmptyHttpResult. This has secondary effect of allowing ResultExtensions to be trimmed when it is not used since it is not going to share the static constructor with EmptyHttpResult.

@Copilot Copilot AI review requested due to automatic review settings August 31, 2025 13:48
@github-actions github-actions bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Aug 31, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR eliminates redundant caching of the EmptyHttpResult singleton by converting properties from cached getters to direct property accessors. The changes ensure that the singleton pattern is respected without creating unnecessary intermediate cached instances.

  • Converts TypedResults.Empty from a cached property to a direct property accessor
  • Converts Results.Empty from delegating to TypedResults.Empty to directly accessing the singleton instance

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Http/Http.Results/src/TypedResults.cs Changed Empty property from cached getter to direct property accessor
src/Http/Http.Results/src/Results.cs Changed Empty property to directly access EmptyHttpResult.Instance instead of TypedResults.Empty

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Sep 7, 2025
@jkotas jkotas closed this Sep 7, 2025
@jkotas jkotas reopened this Sep 7, 2025
@dotnet-policy-service dotnet-policy-service bot added this to the 11.0-preview1 milestone Sep 7, 2025
@davidfowl davidfowl merged commit 063ba34 into dotnet:main Sep 25, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants